//==============================================================================
//
// Title:       ScreenRTC.c
// Purpose:     A short description of the implementation.
//
// Created on:  23/09/2010 at 08:37:36 by LEGRAND.
// Copyright:   GRPLEG. All Rights Reserved.
//
//==============================================================================

//==============================================================================
// Include files
#include "Screen_SetVbatMaxFast.h"
#include "led.h"
//==============================================================================
// Constants
//==============================================================================
// Types

//==============================================================================
// Static global variables

//==============================================================================
// Static functions
static unsigned char Screen_SetVbatMaxFast_OnInitialize( void );

static unsigned char Screen_SetVbatMaxFast_ProcessMessage( TMessage* pMsg );

//==============================================================================
// Global variables


//==============================================================================
// Global functions

const TScreen Screen_SetVbatMaxFast =
{
	.ProcessMessage 	= Screen_SetVbatMaxFast_ProcessMessage,
	.OnInitialize   	= Screen_SetVbatMaxFast_OnInitialize,
};

static unsigned char Screen_SetVbatMaxFast_OnInitialize( void )
{
          LCD_Clear();
          LCD_DrawString("Vbat Max FAST",1,LINE_1);
          LCD_DrawVoltage(EE_VbatMaxFast,1,LINE_2);
          LCD_DrawChar(' ');LCD_DrawChar(' ');
          LCD_DrawChar(ARROW_UP);
          LCD_DrawChar(ARROW_DOWN);
          LCD_DrawString("  ->OK",11,LINE_2);

  return 0U;
}

static unsigned char Screen_SetVbatMaxFast_ProcessMessage( TMessage* pMsg )
{

  	if( pMsg->ID == MSG_KEY_BOARD )
	{

		switch( pMsg->Param1 )
		{
                                          case KEY_OK:
                                          {
                                                  Screen_SetCurrent(&Screen_Init);
                                          }
                                          break;
                                          case KEY_UP:
                                          {
                                                  EE_VbatMaxFast = EE_VbatMaxFast + VOLTAGE_STEP;

                                                  if(EE_VbatMaxFast >= MAX_VBAT)
                                                  {
                                                            EE_VbatMaxFast=MAX_VBAT;
                                                  }
                                                  LCD_DrawVoltage(EE_VbatMaxFast,1,LINE_2);
                                          }
                                          break;
                                          case KEY_DOWN:
                                          {
                                                  EE_VbatMaxFast = EE_VbatMaxFast - VOLTAGE_STEP;

                                                  if(EE_VbatMaxFast <= MIN_VBAT)
                                                  {
                                                            EE_VbatMaxFast=MIN_VBAT;
                                                  }
                                                  LCD_DrawVoltage(EE_VbatMaxFast,1,LINE_2);
                                          }
                                          break;
                                          case KEY_LEFT:
                                          {
                                                  Screen_SetCurrent(&Screen_SetVbatMaxLow);
                                          }
                                          break;
                                          case KEY_RIGHT:
                                          {
                                                  Screen_SetCurrent(&Screen_SetVbatMaxTopOff);
                                          }
                                          break;
                                }
                }
                else if( pMsg->ID == MSG_TIMER )
                  {


                  }
                  else
                  {

                   }



	return 0U;
}

